home *** CD-ROM | disk | FTP | other *** search
- property furCnt, furNum, furList, oldFurType, furType, pippi, pippiType, staticPippi, rot, fallen, timerX, xFrame, room, dizzy, dizzyLast
- global autoMoveObject, sndObject
-
- on new me, pXframe, pRoom
- if voidp(pRoom) = 0 then
- room = pRoom
- else
- room = 1
- end if
- if voidp(pXframe) = 0 then
- xFrame = pXframe
- else
- xFrame = the frame
- end if
- fallen = 0
- staticPippi = 0
- furType = 1
- oldFurType = 1
- furList = []
- pippiType = 0
- pippi = sprite(30)
- timerX = the ticks + 1500
- clearDizzy(me)
- return me
- end
-
- on traceCursor me, pPos
- if staticPippi = 0 then
- H = pPos[1] - pippi.loc[1]
- v = pPos[2] - pippi.loc[2]
- if (H > 0) and (v > 0) then
- if dizzyLast <> 1 then
- dizzy[1] = dizzy[1] + 1
- dizzyLast = 1
- end if
- if H > v then
- X = 1
- else
- X = 2
- end if
- else
- if (H < 0) and (v > 0) then
- if (H * -1) < v then
- X = 3
- else
- X = 4
- end if
- else
- if (H < 0) and (v < 0) then
- if dizzyLast <> 2 then
- dizzy[2] = dizzy[2] + 1
- dizzyLast = 2
- end if
- if H < v then
- X = 5
- else
- X = 6
- end if
- else
- if (H > 0) and (v < 0) then
- if H < (v * -1) then
- X = 7
- else
- X = 8
- end if
- end if
- end if
- end if
- end if
- if X <> VOID then
- rot = (X * 45) - 110
- pippi.rotation = rot
- end if
- testDizzy(me)
- end if
- end
-
- on testDizzy me
- if dizzy <> [0, 0] then
- Ok = 1
- repeat with n = 1 to 2
- if dizzy[n] < 3 then
- Ok = 0
- exit repeat
- end if
- end repeat
- if Ok = 1 then
- if sound(2).member = member(1, 1) then
- sound(2).stop()
- end if
- fallXPippi(me)
- end if
- end if
- end
-
- on clearDizzy me
- dizzyLast = 1
- dizzy = [0, 0]
- end
-
- on setmember me
- if pippi.member <> member("p" & string(pippiType), 1) then
- pippi.member = member("p" & string(pippiType), 1)
- updateStage()
- end if
- end
-
- on setPippiHard me, pRot
- staticPippi = 1
- pippi.member = member("p8", 1)
- pippi.rotation = pRot
- updateStage()
- end
-
- on clearFur me, pNum
- furCnt = 0
- end
-
- on reportEndFur me, pNum
- furNum = pNum
- end
-
- on reportLastFur me, pNum
- furList = [furCnt, pNum]
- end
-
- on reportFur me, pCnt, pFurType, pRot
- if fallen = 0 then
- if furCnt = 0 then
- furCnt = pCnt
- else
- clearDizzy(me)
- timerX = the ticks
- if pCnt = furCnt then
- lookup(me)
- else
- oldFurType = furType
- if (pCnt = (furCnt + 1)) or (pCnt = (furCnt - 1)) then
- furType = pFurType
- furCnt = pCnt
- movePippi(me, pCnt)
- if voidp(pRot) = 0 then
- setPippiHard(me, pRot)
- else
- staticPippi = 0
- end if
- else
- fallPippi(me, pCnt)
- end if
- end if
- end if
- end if
- end
-
- on lookup me
- if staticPippi = 0 then
- orgType = pippiType
- pippiType = 0
- setmember(me)
- v = the ticks + 15
- repeat while the ticks < v
- end repeat
- twinkle(me)
- v = the ticks + 10
- repeat while the ticks < v
- end repeat
- pippiType = orgType
- setmember(me)
- end if
- end
-
- on twinkle me
- pippiType = -1
- setmember(me)
- v = the ticks + 6
- repeat while the ticks < v
- end repeat
- pippiType = 0
- setmember(me)
- end
-
- on movePippi me, pCnt
- staticPippi = 0
- cursorPos = the mouseLoc
- me.traceCursor(cursorPos)
- if oldFurType <> 8 then
- pippiType = 5
- setmember(me)
- v = the ticks + 25
- repeat while the ticks < v
- end repeat
- end if
- pippiType = random(2) + 5
- setmember(me)
- autoMoveObject.autoMove(pippi, sprite(pCnt).loc)
- v = random(5)
- sound(1).play(member("hopp-" & string(v), 1))
- if furType = 1 then
- pippiType = 5
- setmember(me)
- v = the ticks + 20
- repeat while the ticks < v
- end repeat
- end if
- pippiType = furType
- setmember(me)
- if pCnt = furNum then
- A = value((the frameLabel).char[2])
- b = A + 1
- room = b
- go(string(xFrame) & string(b))
- end if
- sndObject.respondSnd(3, 4, 1, 1)
- end
-
- on fallPippi me, pCnt
- if fallen = 0 then
- staticPippi = 1
- if oldFurType <> 8 then
- pippiType = 5
- setmember(me)
- v = the ticks + 25
- repeat while the ticks < v
- end repeat
- end if
- pippiType = random(2) + 5
- setmember(me)
- pLoc = the mouseLoc
- qLoc = me.lookForPlaceToFall(pLoc, 250)
- autoMoveObject.autoMove(pippi, qLoc)
- updateStage()
- pippiType = 9
- setmember(me)
- fallen = 1
- sound(1).play(member("duns", 1))
- end if
- updateStage()
- end
-
- on fallXPippi me
- if fallen = 0 then
- pippiType = 9
- setmember(me)
- pLoc = the mouseLoc
- qLoc = me.lookForPlaceToFall(pLoc, 130)
- autoMoveObject.autoMove(pippi, qLoc)
- fallen = 1
- sound(1).play(member("duns", 1))
- end if
- updateStage()
- end
-
- on lookForPlaceToFall me, pLoc, pDist
- xLoc = me.testOnFloor(pLoc)
- yLoc = me.testDistance(xLoc, pDist)
- zLoc = me.testInterSectFur(yLoc)
- return zLoc
- end
-
- on testOnFloor me, pLoc
- xLoc = pLoc
- if inside(xLoc, sprite(5).rect) = 0 then
- xLoc = ((xLoc - pippi.loc) / 2) + ((xLoc - pippi.loc) / 3) + pippi.loc
- end if
- if inside(xLoc, sprite(5).rect) = 0 then
- repeat while inside(xLoc, sprite(5).rect) = 0
- vv = point(400, 300)
- xLoc = ((xLoc - vv) / 2) + ((xLoc - vv) / 3) + vv
- end repeat
- end if
- return xLoc
- end
-
- on testInterSectFur me, loc1
- pLoc = loc1
- repeat with n = 1 to 10
- repeat with n = furList[1] to furList[2]
- if intersect(rect(pLoc[1] - 15, pLoc[2] - 15, pLoc[1] + 15, pLoc[2] + 15), sprite(n).rect) > rect(0, 0, 0, 0) then
- repeat while intersect(rect(pLoc[1] - 20, pLoc[2] - 20, pLoc[1] + 20, pLoc[2] + 20), sprite(n).rect) > rect(0, 0, 0, 0)
- vv = point(400, 300)
- pLoc = ((pLoc - vv) / 2) + ((pLoc - vv) / 3) + vv
- end repeat
- exit repeat
- end if
- end repeat
- end repeat
- return pLoc
- end
-
- on testDistance me, loc2, pDist
- dist = pDist
- loc1 = pippi.loc
- loc1a = pippi.loc
- loc2a = loc2
- repeat with n = 1 to 10
- H = loc2a[1] - loc1a[1]
- v = loc2a[2] - loc1a[2]
- A = H
- b = v
- if A < 0 then
- A = A * -1
- end if
- if b < 0 then
- b = b * -1
- end if
- if A > b then
- c = A
- else
- c = b
- end if
- if c > dist then
- loc2a = ((loc2a - loc1) / 2) + ((loc2a - loc1) / 4) + loc1a
- next repeat
- end if
- pLoc = loc2a
- exit repeat
- end repeat
- return pLoc
- end
-